<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.mselect.css" rel="stylesheet" />
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.mselect.js?"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.multiselect.js"></script>
<script type="text/javascript">
$(function(){
	$("a[rel^='pretty_photo']").prettyPhoto({theme: 'facebook'});
	var url_arr = <?=$url_arr?>;
	var product_categories_data = <?=$product_categories?>;
	$(document).mselect(product_categories_data, 'product_categories_id', 'product_categories_id', "<?=(isset($_GET['product_categories_id']))?$_GET['product_categories_id']:0?>");
	$("#Export_SKUList_btn").click(function(){
		window.location.href="<?=url('Online::ProductInfo/Export')?>&search=" + url_arr;
	});
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
	<tr>
		<th>&nbsp;</th>
		<th>SKU</th>
		<td><input type="text" name="sku" size="46" value="<?=empty($_GET['sku']) ? '' : $_GET['sku']?>"/>多个sku用英文逗号隔开(例：000001,000002 )</td>
	</tr>
	<tr>
		<th>&nbsp;</th>
		<th>描述语种(包含)</th>
		<td>
		<?foreach (Q::ini('custom_flag/online_ebay_product_language') as $l):?>
		<label><input type="checkbox" name="lang[]" class="lang" value="<?=$l['value']?>" <?=isset($_GET['lang']) && in_array($l['value'], $_GET['lang']) ? 'checked="checked"' : ''?>><?=$l['name']?> </label>
		<?endforeach;?>
		</td>
	</tr>
	<tr>
		<th>&nbsp;</th>
		<th>描述语种(非包含)</th>
		<td>
		<?foreach (Q::ini('custom_flag/online_ebay_product_language') as $l):?>
		<label><input type="checkbox" name="no_lang[]" class="no_lang" value="<?=$l['value']?>" <?=isset($_GET['no_lang']) && in_array($l['value'], $_GET['no_lang']) ? 'checked="checked"' : ''?>><?=$l['name']?> </label>
		<?endforeach;?>
		</td>
	</tr>
	<tr>
		<th>&nbsp;</th>
		<th>产品分类</th>
		<td><input type="hidden" name="product_categories_id" id="product_categories_id" /></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="hidden" name="is_search" value="1" /></td>
		<td><input type="submit" class="button" value="查询" /></td>
	</tr>
</table>
</form>
</fieldset>

<table class="list_table" width="100%">
	<tr>
		<th width="110">SKU</th>
		<th width="60">产品图片</th>
		<th>中文名称</th>
		<?foreach (Q::ini('custom_flag/online_ebay_product_language') as $l):?>
		<th width="50"><?=$l['text']?></th>
		<?endforeach;?>
	</tr>
	<?foreach ($product as $k => $p):?>
	<tr>
		<td><a href="<?=url('Online::ProductInfo/Detail', array('number' => $k));?>"><?=$k?></a></td>
		<td>
			<?if (isset($p['pic']) && $p['pic']):?>
				<?$pretty_photo_number = 0;?>
				<?foreach ($p['pic'] as $pic):?>
				<a rel="pretty_photo[1]" href="<?=$pic?>"><?if(!$pretty_photo_number):?><img width="50" src="<?=$pic?>" /><?endif;?></a>
				<?$pretty_photo_number = 1;?>
				<?endforeach;?>
			<?endif;?>	
		</td>
		<td align="left"><?=$p['name']?></td>
		<?foreach (Q::ini('custom_flag/online_ebay_product_language') as $l):?>
		<td><?if (in_array($l['value'], $p['lang'])):?><?='√'?><?else:?><?='X'?><?endif;?></td>
		<?endforeach;?>
	</tr>
	<?endforeach;?>
</table>
<?=$page?>
<table class="list_table">
	<tr>
		<td>按搜索条件导出</td>
		<td>
			<input type="button" class="button" value="导出产品资料" id="Export_SKUList_btn" />
		</td>
	</tr>
</table>
<?php $this->_endblock();?>